<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    /* 1.父级div的高度由内部的div内容撑开:
          解决方案: 父级div的高度设置为auto,且设置overflow属性;当外层div设置固定的高度时,div内多余的内容的处理方案根据overflow来进行;若没有设置固定高度,则高度会被内层div撑开
       2.里层div的高度始终与外层div的高度一样
          解决方案: 利用绝对定位;top的值为0,bottom的值也为0 即可让里层div的高度与外层的高度一样
     */
    .layout{
      margin: 0 auto;
      border: 1px solid red;
      min-width: 200px;
      height: auto;
      width: 500px;
      overflow: auto;
      position: relative;
    }
    .left{
      float: left;
      width: 50px;
      min-height: 50px;
      border-right: 1px solid greenyellow;
    }
    .right{
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 50px;
      border-left: 1px solid green;
    }
  </style>
</head>
<body>
<button onclick="addHeigth()">点击一下</button>
<div class="layout">
  <div class="left" id="left"></div>
  <div class="right"></div>
</div>
  <script>
    function addHeigth () {
      var node = document.getElementById('left')
      // clientHeight 为浏览器计算出来的属性(只读)
      node.style.height = node.clientHeight + 200 +'px'
    }
  </script>
</body>
</html>
